package com.example.esredisrabbitmqdemo.dao;

import com.example.esredisrabbitmqdemo.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: es-redis-rabbitmq-demo
 * @BelongsPackage: com.example.esredisrabbitmqdemo.dao
 * @Author: 江岸
 * @CreateTime: 2020-07-04 16:17
 * @Description:
 */
@Repository
@Mapper
public interface UserMapper {
    int add(User user);

    @Select("select * from user where id = #{id}")
    User queryById(int id);

    @Delete("delete from user where id =#{id}")
    int delete(int id);

    @Update("update user set username = #{username},password=#{password} where id =#{id}")
    int update(User user);

    @Select("select * from user ")
    List<User> findAll();
}
